Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
A tiny, simple, functional helper library for generating DOM elements. Inspired in part by the jade templating engine for node.
A tiny, functional helper library for generating DOM elements. Inspired in part by the jade templating engine for node.
Ta-Dom generates a bunch of named global functions that return an HTML element with the matching tag name. The optional attributes parameter is a plain object whose key/value pairs make up the desired attributes. The optional content param can hold text content, or any number of other elements.
div(attributesObject, ...content);
Event listeners can also be specified in the attributes object by specifying the name of the event prefixed with 'on-' and a function defining the event handler.
div({'on-click',(event)=> console.log(event)});
generate a single div element with a class:
div({class:'how-i-like-my-divs'});
<div class="how-i-like-my-divs"></div>
a really bare header:
header();
<header></header>
with some text content:
div({class:'how-i-like-my-divs'}, 'Hello, World!');
<div class="how-i-like-my-divs">
Hello, World!
</div>
with some nested elements:
div({class:'how-i-like-my-divs'}, 'Hello, World!',
h1('HEADER'),
article({class:'how-i-like-my-articles'}, 'blah blah blah');
);
<div class="how-i-like-my-divs">
Hello, World!
<h1>HEADER</h1>
<article>blah blah blah</article>
</div>
Create re-usable modules:
const myArticle = (headline, articleText) => {
return div({class:'my-article'},
h1({class:'my-header'}, headline),
article({class:'my-class'}, articleText)
);
};
div({}, myArticle('My Favorite things', 'Foo and bar.'),
myArticle('About Bananas', 'Yellow and delicious.'));
<div>
<div class="my-article">
<h1>My Favorite Things</h1>
<article>Foo and bar.</article>
</div>
<div class="my-article">
<h1>About Bananas</h1>
<article>Yellow and delicious.</article>
</div>
Using some fancy component library, define a function to instantiate your components:
const myElement = generate('my-element');
myElement();
<my-element><my-element>
For more examples, check out the examples
directory.
Ta-dom uses Karma for unit testing. To run tests:
npm test
FAQs
A tiny, simple, functional helper library for generating DOM elements. Inspired in part by the jade templating engine for node.
We found that ta-dom demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.